package tw.singleton.SingleObject;

public class LazySynchronizedSingle {
    //利用synchronized 来实现单例模式，
    //线程安全，但是效率低
    private static LazySynchronizedSingle instance;
    private LazySynchronizedSingle (){}
    public static synchronized LazySynchronizedSingle getInstance() {
        if (instance == null) {
            instance = new LazySynchronizedSingle();
        }
        return instance;
    }
    public void showMessage(){
        System.out.println("Hello World!懒汉式加载，多线程不安全");
    }

}
